﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kiosk.Library
{
    partial class IconReadOnlyList
    {
        // searches for a keyword in a block of text.  returns a default 
        public static Uri FindIconFileByKeyword(string text)
        {
            Uri iconURI = null;
            IconReadOnlyList icons = IconReadOnlyList.GetAll();
            
            try
            {
                var file = icons.Single(i => text.Contains(i.IconKeyword)).IconFile;
                iconURI = new Uri(file, UriKind.Relative);
            }
            catch (Exception ex)
            {
                iconURI = null;
            }
            return iconURI;
        }
    }
}
